export const calcMixCol = (color: string, white: string = 'ffffff', first: number = 0.42, second: number = 0.58, alpah: string = '') => {
  // return color-mix(in srgb, var(--main-color) 42%, #ffffff 58%)
  //  与白色混合
  color = color.replace('#', '')

  const r = Number.parseInt(color.slice(0, 2), 16)
  const g = Number.parseInt(color.slice(2, 4), 16)
  const b = Number.parseInt(color.slice(4, 6), 16)

  const r2 = Number.parseInt(white.slice(0, 2), 16)
  const g2 = Number.parseInt(white.slice(2, 4), 16)
  const b2 = Number.parseInt(white.slice(4, 6), 16)

  const r3 = Math.round(r * first + r2 * second)
  const g3 = Math.round(g * first + g2 * second)
  const b3 = Math.round(b * first + b2 * second)

  return `#${r3.toString(16).padStart(2, '0')}${g3.toString(16).padStart(2, '0')}${b3.toString(16).padStart(2, '0')}${alpah}`
}
